<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>

<body class="gray-bg">
	<div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="hc-form">
					<div class="select-list">
						<ul>
							<li>
								分析类型：
								<select id="analysisType"  name="analysisType"  style="width: 120px">
									<option value="0" >所有</option>
									<option value="1" >一周内到期</option>
									<option value="2">两周内到期</option>
									<option value="3">立项高风险</option>
								</select>
							</li>
							<li>
								PDU：
								<select id="pdu"  name="pdu"  style="width: 120px" th:with="type=${@dict.getType('human_pdu')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>
							<li>
								地域：
								<select id="region"  name="region"  style="width: 120px" th:with="type=${@dict.getType('check_region')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>

							<li>
								PO：
								<input type="text" style="width: 120px" name="poCode" id="poCode"/>
							</li>
							<li>
								立项编码：
								<input type="text" style="width: 120px" name="prjCreateCode" id="prjCreateCode"/>
							</li>
							<li>
								项目名称：
								<input type="text" style="width: 120px" name="poName" id="poName"/>
							</li>
							<li>
								华为PM：
								<input type="text" style="width: 120px" name="hwPM" id="hwPM"/>
							</li>
							<li>
								蚂蚁PM：
								<input type="text" style="width: 120px" name="isoftPM" id="isoftPM"/>
							</li>
							<li>
								<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-success btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>

				</form>
			</div>
			<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="po:board:add">
					<i class="fa fa-plus"></i> 新增
				</a>
				<a class="btn btn-success btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="po:board:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="po:board:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="po:board:export">
					<i class="fa fa-download"></i> 导出
				</a>
			</div>

			<div class="col-sm-12 select-table table-bordered">
			    <table class="table table-hover" id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	<div th:include="include :: footer"></div>
	<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('po:board:edit')}]];
		var removeFlag = [[${@permission.hasPermi('po:board:remove')}]];
		var poTypes = [[${@dict.getType('po_type')}]];
		var regions = [[${@dict.getType('check_region')}]];
		var pdus = [[${@dict.getType('human_pdu')}]];
		var statusDatas = [[${@dict.getType('po_status')}]];
		var risks = [[${@dict.getType('risk_level')}]];

		var prefix = ctx + "po/board";

		$(function() {
			$('body').layout({ west__size: 185 });
			queryPOList();
		});

	 	//表格超出宽度鼠标悬停显示td内容
		function paramsMatter(value, row, index) {
			var span = document.createElement("span");
			span.setAttribute("title", value);
			span.innerHTML = value;
			return span.outerHTML;
		}
		//td宽度以及内容超过宽度隐藏
		function formatTableUnit(value, row, index) {
			return {
				css: {
					"white-space": "nowrap",
					"text-overflow": "ellipsis",
					"overflow": "hidden",
					"max-width": "60px"
				}
			}
		}

		function queryPOList() {
		    var options = {
		        url: prefix + "/list",
		        createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        removeUrl: prefix + "/remove",
		        exportUrl: prefix+ "/export",
		        modalName: "PO",
		        search: false,
		        showExport: false,
		        showColumns: false,
		        showRefresh: false,
		        showToggle: false,
		        showHeader: false,
		        showFooter: false,
		        searchable: false,
		        smartDisplay:false,
		        showSearch:false,
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'poCode',
		            title: 'PO编号'
		        },
		        {
		            field: 'prjCreateCode',
		            title: '立项编号'
		        },
		        {
		            field: 'poName',
		            title: '项目名称',
					width: '100px',
		            cellStyle: formatTableUnit,
                    formatter: paramsMatter
		        },
		        {
		            field: 'prjType',
		            title: '项目类型',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(poTypes, value);
		            }
		        },
		        {
		            field: 'pdu',
		            title: 'PDU',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(pdus, value);
		            }
		        },
		        {
		            field: 'region',
		            title: '地域',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(regions, value);
		            }
		        },
		        {
		            field: 'status',
		            title: '合同状态',
		               formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(statusDatas, value);
		            }
		        },
		        {
		            field: 'hwPM',
		            title: '华为PM'
		        },
		        {
		            field: 'isoftPM',
		            title: '蚂蚁PM'
		        },
		        {
		            field: 'poAmounts',
		            title: 'PO金额'
		        },
		        {
		            field: 'monthPeoples',
		            title: '月度人力'
		        },
		        {
		            field: 'startDate',
		            title: '开始日期'
		        },
		        {
		            field: 'endDate',
		            title: '结束日期'
		        },
		        {
		            field: 'poConsumedAmounts',
		            title: 'PO消耗金额'
		        },
		        {
		            field: 'poSurplusAmounts',
		            title: 'PO剩余金额'
		        },
		        {
		            field: 'poConsumedRate',
		            title: 'PO消耗百分比'
		        },
		        {
		            field: 'poConsumeDate',
		            title: 'PO消耗预计完成日期'
		        },
		        {
		            field: 'newPORisk',
		            title: '新合同风险级别',
		               formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(risks, value);
		            }
		        },
		        {
		            field: 'newPORemark',
		            title: '新合同进展',
		            cellStyle: formatTableUnit,
                    formatter: paramsMatter
		        },
		        {
		            field: 'updateTime',
		            title: '更新时间'
		        },
		        {
		            field: 'updateBy',
		            title: '更新人'
		        }]
		    };
		    $.table.init(options);
		}

	</script>
</body>
</html>